
import java.awt.CardLayout;
import java.util.ArrayList;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * HotelLayout.java
 *
 * Created on Dec 15, 2011, 3:32:02 PM
 */

/**
 *
 * @author dabeast23
 */
public class HotelLayout extends javax.swing.JFrame {

    /** Creates new form HotelLayout */
    public HotelLayout() {
        setResizable(false);
	setTitle("Hotel Kiosk: Hotel Layout");
	setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        initComponents();
        this.setLocationRelativeTo(null);
        infoBox.setText("This is the main floor. Here you can check in and request assistance. If you need to call us dial 444 - 5555 from your room. "
                    + "\nThere are 3 elevators and 2 staircases on this floor.");
    }

    public HotelLayout(ArrayList<Reservation> reservationList) {
        setResizable(false);
	setTitle("Hotel Kiosk: Hotel Layout");
	setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        initComponents();
        this.setLocationRelativeTo(null);
        this.reservationList = reservationList;
        infoBox.setText("This is the main floor. Here you can check in and request assistance. If you need to call us dial 444 - 5555 from your room. "
                    + "\nThere are 3 elevators and 2 staircases on this floor.");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        backButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        jSeparator4 = new javax.swing.JToolBar.Separator();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        selectedFloor = new javax.swing.JComboBox();
        jScrollPane2 = new javax.swing.JScrollPane();
        infoBox = new javax.swing.JTextArea();
        headingLabel = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        ContainerPanel = new javax.swing.JPanel();
        mainFloorLayout1 = new MainFloorLayout();
        firstFloorLayout1 = new FirstFloorLayout();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(102, 0, 0));

        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);

        backButton.setText("   Back  ");
        backButton.setFocusable(false);
        backButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        backButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        backButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(backButton);
        jToolBar1.add(jSeparator1);
        jToolBar1.add(jSeparator2);
        jToolBar1.add(jSeparator3);
        jToolBar1.add(jSeparator4);
        jToolBar1.add(jSeparator5);

        selectedFloor.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Main Floor", "Floor 1" }));
        selectedFloor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                selectedFloorActionPerformed(evt);
            }
        });
        jToolBar1.add(selectedFloor);

        infoBox.setBackground(new java.awt.Color(255, 255, 204));
        infoBox.setColumns(20);
        infoBox.setRows(5);
        jScrollPane2.setViewportView(infoBox);

        headingLabel.setFont(new java.awt.Font("Comic Sans MS", 0, 18)); // NOI18N
        headingLabel.setForeground(new java.awt.Color(255, 255, 204));
        headingLabel.setText("Floor Layout");

        jLabel2.setFont(new java.awt.Font("Comic Sans MS", 0, 18)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(255, 255, 204));
        jLabel2.setText("Information:");

        ContainerPanel.setBackground(new java.awt.Color(0, 0, 0));
        ContainerPanel.setLayout(new java.awt.CardLayout());
        ContainerPanel.add(mainFloorLayout1, "mainFloor");

        firstFloorLayout1.setBackground(new java.awt.Color(0, 0, 0));
        ContainerPanel.add(firstFloorLayout1, "firstFloor");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 800, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(headingLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(472, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 780, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(472, Short.MAX_VALUE))
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ContainerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(headingLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ContainerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void selectedFloorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectedFloorActionPerformed
        if(selectedFloor.getSelectedIndex()== 0)
        {
            CardLayout cl = (CardLayout)(ContainerPanel.getLayout());
            cl.show(ContainerPanel, "mainFloor");
            infoBox.setText("This is the main floor. Here you can check in and request assistance. If you need to call us dial 444 - 5555 from your room. "
                    + "\nThere are 3 elevators and 2 staircases on this floor.");
        }
        else if(selectedFloor.getSelectedIndex() == 1)
        {
            CardLayout cl = (CardLayout)(ContainerPanel.getLayout());
            cl.show(ContainerPanel, "firstFloor");
            infoBox.setText("This is the 1st Floor. Rooms 100 - 102 are on the left, 103 - 109 to the south, 110 - 112 are on the right. "
                    + "\nThe room in the middle, 113 is the Presidential Suite. There is one on every floor.");
        }
    }//GEN-LAST:event_selectedFloorActionPerformed

    private void backButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backButtonActionPerformed
        ProspectiveGuest PG = new ProspectiveGuest(reservationList);
        PG.setVisible(true);
        this.setVisible(false);
    }//GEN-LAST:event_backButtonActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new HotelLayout().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel ContainerPanel;
    private javax.swing.JButton backButton;
    private javax.swing.ButtonGroup buttonGroup1;
    private FirstFloorLayout firstFloorLayout1;
    private javax.swing.JLabel headingLabel;
    public javax.swing.JTextArea infoBox;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator4;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToolBar jToolBar1;
    private MainFloorLayout mainFloorLayout1;
    private javax.swing.JComboBox selectedFloor;
    // End of variables declaration//GEN-END:variables
    private ArrayList <Reservation> reservationList;
    FirstFloorLayout firstFloor = new FirstFloorLayout();

    public javax.swing.JTextArea getInfoBox()
    {
        return infoBox;
    }
}
